package com.czf.common;

import com.czf.common.util.UuidGenerator;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.net.URL;
import java.time.Instant;

/**
 * @author zfChen
 * @create 2022/1/29 17:01
 */
@RestController
@RequestMapping("/abc")
public class Testcontroller {

    @RequestMapping("/controller")
    public void controller(HttpServletRequest req, HttpServletResponse resp){
        String contextPath = req.getContextPath();
        System.out.println("contextPath:"+contextPath);

    }

    public void test1() {
        System.out.println("test");
        URL resource = this.getClass().getClassLoader().getResource("");
        System.out.println(resource.getFile()+"----"+resource.getPath());
    }

    public static void main(String[] args) throws Exception {
        SSLContext context = SSLContext.getInstance("TLS");
        context.init(null, null, null);

        SSLSocketFactory factory = (SSLSocketFactory) context.getSocketFactory();
        SSLSocket socket = (SSLSocket) factory.createSocket();

        String[] protocols = socket.getSupportedProtocols();

        System.out.println("Supported Protocols: " + protocols.length);
        for (int i = 0; i < protocols.length; i++) {
            System.out.println(" " + protocols[i]);
        }

        protocols = socket.getEnabledProtocols();

        System.out.println("Enabled Protocols: " + protocols.length);
        for (int i = 0; i < protocols.length; i++) {
            System.out.println(" " + protocols[i]);
        }

    }



}
